#!/usr/bin/env python3
"""
CoordinationMode枚举诊断脚本
"""

def diagnose_coordination_mode():
    """诊断CoordinationMode枚举问题"""
    print("=== CoordinationMode枚举诊断 ===\n")
    
    try:
        # 尝试导入CoordinationMode
        from aiquant.coordination.coordination_patterns import CoordinationMode
        print("✅ 成功导入CoordinationMode")
        
        # 列出所有枚举值
        print(f"📋 当前CoordinationMode枚举值:")
        for mode in CoordinationMode:
            print(f"   - {mode.name} = {mode.value}")
        
        # 检查HYBRID是否存在
        try:
            hybrid_mode = CoordinationMode.HYBRID
            print(f"✅ HYBRID模式存在: {hybrid_mode}")
        except AttributeError:
            print("❌ HYBRID模式不存在")
        
        # 检查SWARM是否存在
        try:
            swarm_mode = CoordinationMode.SWARM
            print(f"✅ SWARM模式存在: {swarm_mode}")
        except AttributeError:
            print("❌ SWARM模式不存在")
            
    except ImportError as e:
        print(f"❌ 导入CoordinationMode失败: {e}")
        return
    
    print("\n" + "="*50)
    
    # 检查mode_selector.py中的引用
    try:
        print("🔍 检查mode_selector.py中的HYBRID引用...")
        
        # 尝试导入ModeSelector
        from aiquant.coordination.mode_selector import ModeSelector
        print("✅ 成功导入ModeSelector")
        
        # 尝试创建实例
        selector = ModeSelector()
        print("✅ 成功创建ModeSelector实例")
        
        # 检查selection_rules中是否有HYBRID
        if hasattr(selector, 'selection_rules'):
            if CoordinationMode.HYBRID in selector.selection_rules:
                print("✅ selection_rules中包含HYBRID规则")
            else:
                print("❌ selection_rules中不包含HYBRID规则")
        
    except Exception as e:
        print(f"❌ ModeSelector相关检查失败: {e}")
    
    print("\n" + "="*50)
    
    # 检查loguru依赖
    try:
        import loguru
        print("✅ loguru依赖可用")
    except ImportError:
        print("❌ loguru依赖缺失")

if __name__ == "__main__":
    diagnose_coordination_mode()